package org.htmlparser.util;

import java.io.Serializable;
import org.htmlparser.util.sort.Ordered;

public class CharacterReference
  implements Serializable, Cloneable, Ordered
{
  protected int mCharacter;
  protected String mKernel;

  public CharacterReference(String paramString, int paramInt)
  {
    this.mKernel = paramString;
    this.mCharacter = paramInt;
    if (this.mKernel == null)
      this.mKernel = "";
  }

  public int compare(Object paramObject)
  {
    CharacterReference localCharacterReference = (CharacterReference)paramObject;
    return getKernel().compareTo(localCharacterReference.getKernel());
  }

  public int getCharacter()
  {
    return this.mCharacter;
  }

  public String getKernel()
  {
    return this.mKernel;
  }

  void setCharacter(int paramInt)
  {
    this.mCharacter = paramInt;
  }

  void setKernel(String paramString)
  {
    this.mKernel = paramString;
  }

  public String toString()
  {
    StringBuffer localStringBuffer = new StringBuffer(16);
    String str = Integer.toHexString(getCharacter());
    localStringBuffer.append("\\u");
    for (int i = str.length(); i < 4; ++i)
      localStringBuffer.append("0");
    localStringBuffer.append(str);
    localStringBuffer.append("[");
    localStringBuffer.append(getKernel());
    localStringBuffer.append("]");
    return localStringBuffer.toString();
  }
}